package com.xiaotu.service.redission.impl;

import com.xiaotu.service.redission.Pg2MysqlRedisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhangxiao
 * @create 2022-03-04 14:21
 */
@Service
@Slf4j
public class Pg2MysqlRedisServiceImpl implements Pg2MysqlRedisService {

    @Autowired
    private RedisTemplate<String, String> redisTemplate;

    @Override
    public void addDateQueue(String key, List<String> dates) {
        redisTemplate.opsForList().leftPushAll(key, dates);
    }

    @Override
    public String getDateQueue(String key) {
        return redisTemplate.opsForList().rightPop(key);
    }

}
